package com.example.demo.service;

import com.example.demo.bean.User;
import com.example.demo.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author Jim Chen
 * @date 2021-04-15
 */
@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    public List<User> findAll() {
        return userDao.findAll();
    }

    public User getById(Integer id){
        return userDao.getById(id);
    }

    public User create(User user){
        userDao.create(user);
        return user;
    }

    public User update(User user){
        userDao.update(user);
        return user;
    }

    public int delete(Integer id){
        return userDao.delete(id);
    }

}
